package jiHeKuangJia_ZuoYe1;

public class Staff  implements Comparable<Staff>{
	private String name;
	private String buMenName;
	private String zhiweiName;
	private int age;
	private char gender;
	private double salary;



	public Staff(String name) {
		super();
		this.name = name;
	}



	public Staff(String name, String buMenName, String zhiweiName, int age) {
		super();
		this.name = name;
		this.buMenName = buMenName;
		this.zhiweiName = zhiweiName;
		this.age = age;
	}

	public String toString() {
		return name+"  "+buMenName+"    "+zhiweiName+"  "+age;
	}



	public String getName() {
		return name;
	}





	public void setName(String name) {
		this.name = name;
	}

	public String getBuMenName() {
		return buMenName;
	}

	public void setBuMenName(String buMenName) {
		this.buMenName = buMenName;
	}

	public String getZhiweiName() {
		return zhiweiName;
	}

	public void setZhiweiName(String zhiweiName) {
		this.zhiweiName = zhiweiName;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public char getGender() {
		return gender;
	}

	public void setGender(char gender) {
		this.gender = gender;
	}

	public double getSalary() {
		return salary;
	}

	public void setSalary(double salary) {
		this.salary = salary;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result
				+ ((buMenName == null) ? 0 : buMenName.hashCode());
		result = prime * result + gender;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((zhiweiName == null) ? 0 : zhiweiName.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Staff other = (Staff) obj;
		if (age != other.age)
			return false;
		if (buMenName == null) {
			if (other.buMenName != null)
				return false;
		} else if (!buMenName.equals(other.buMenName))
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (zhiweiName == null) {
			if (other.zhiweiName != null)
				return false;
		} else if (!zhiweiName.equals(other.zhiweiName))
			return false;
		return true;
	}


	public int compareTo(Staff s ) {

		if(this.getAge()==s.getAge()){
			return this.getName().compareTo(s.getName());
		}
		return this.getAge()-s.getAge();
	}








}
